<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    body {
        background-color: #333;
    }

    .box {
        column-width: 250px;
        column-gap: 20px;
        /*改变列间间隙*/
    }

    img {
        width: 250px;
        break-inside: avoid;
        border: 3px solid #fff;
        padding: 6px;
    }
</style>

<body>

    <div class="box">
        <img src="./images/1.jpg">
        <img src="./images/2.jpg">
        <img src="./images/3.jpg">
        <img src="./images/4.jpg">
        <img src="./images/5.jpg">
        <img src="./images/6.jpg">
        <img src="./images/7.jpg">
        <img src="./images/8.jpg">
        <img src="./images/9.jpg">
    </div>
</body>

</html>